package com.example.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MapperProxy implements InvocationHandler {
    private final Class<?> mapperInterface;

    public MapperProxy(Class<?> mapperInterface) {
        this.mapperInterface = mapperInterface;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if ("info".equals(method.getName())) {
            return mapperInterface.getName();   // 返回接口路径
        }
        throw new UnsupportedOperationException(method.getName());
    }
}
